package com.lb.pdm.controller;

import com.lb.pdm.common.result.GraceJSONResult;
import com.lb.pdm.entity.PersonInfo;
import com.lb.pdm.entity.vo.PersonInfoVO;
import com.lb.pdm.service.PersonInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Title: PersonController
 * @Author Wood
 * @Package com.lb.pdm.controller
 * @Date 2025/01/15 20:00
 * @description: 人员信息管理控制器
 */
@RestController
@RequestMapping("/person")
@Tag(name = "人员信息管理", description = "人员信息相关业务接口")
public class PersonController {
    
    @Autowired
    private PersonInfoService personInfoService;
    
    @GetMapping("/getByIdCard")
    @Operation(summary = "根据身份证号获取人员信息", description = "根据身份证号获取完整的人员信息")
    public GraceJSONResult getPersonByIdCard(
            @Parameter(description = "身份证号") @RequestParam String idCard) {
        
        PersonInfoVO person = personInfoService.getPersonByIdCard(idCard);
        if (person != null) {
            return GraceJSONResult.ok(person);
        } else {
            return GraceJSONResult.errorMsg("未找到该身份证号对应的人员信息");
        }
    }



}